<%
local dsp = require "luci.dispatcher"
-%>

<fieldset class="cbi-section">
	<legend><%:Running Status%></legend>
	<fieldset class="cbi-section">
		<div class="cbi-value">
			<label class="cbi-value-title">Nginx <%:Status%></label>
			<div class="cbi-value-field" id="_nginx_status"><%:Collecting data...%></div>
		</div>
		<div class="cbi-value">
			<label class="cbi-value-title">PHP <%:Status%></label>
			<div class="cbi-value-field" id="_php_status"><%:Collecting data...%></div>
		</div>
	</fieldset>
</fieldset>

<script type="text/javascript">//<![CDATA[
	var nginx_status = document.getElementById('_nginx_status');
	var php_status = document.getElementById('_php_status');
	XHR.poll(3,'<%=dsp.build_url("admin/nas/kodexplorer/status")%>', null,
		function(x, json) {
			if (x && x.status == 200) {
				if (nginx_status)
					nginx_status.innerHTML = json.nginx_status ? '<font color="green"><%:RUNNING%> ✓</font>' : '<font color="red"><%:NOT RUNNING%> X</font>';
				if (php_status)
					php_status.innerHTML = json.php_status ? '<font color="green"><%:RUNNING%> ✓</font>' : '<font color="red"><%:NOT RUNNING%> X</font>';
			}
		});
//]]></script>